<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>API参考</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="LibGKSu参考手册">
<link rel="up" href="index.html" title="LibGKSu参考手册">
<link rel="prev" href="about-chinese-version.html" title="中文版说明">
<link rel="next" href="fdl.html" title="GNU 自由文档许可证">
<meta name="generator" content="GTK-Doc V1.17 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="about-chinese-version.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td> </td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">LibGKSu参考手册</th>
<td><a accesskey="n" href="fdl.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#libgksu-API-Reference.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#libgksu-API-Reference.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="libgksu-API-Reference"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="libgksu-API-Reference.top_of_page"></a>API参考</span></h2>
<p>API参考 — 这个API提供的函数可以为用户提供su和sudo的功能。</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="libgksu-API-Reference.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">enum                <a class="link" href="libgksu-API-Reference.html#GksuError" title="enum GksuError">GksuError</a>;
<span class="returnvalue">GksuContext</span> *          <a class="link" href="libgksu-API-Reference.html#gksu-context-new" title="gksu_context_new ()">gksu_context_new</a>                 (<em class="parameter"><code><span class="type">void</span></code></em>);
<span class="returnvalue">void</span>                <a class="link" href="libgksu-API-Reference.html#gksu-context-set-user" title="gksu_context_set_user ()">gksu_context_set_user</a>               (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *username</code></em>);
const <a href="../glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *       <a class="link" href="libgksu-API-Reference.html#gksu-context-get-user" title="gksu_context_get_user ()">gksu_context_get_user</a>               (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="libgksu-API-Reference.html#gksu-context-set-command" title="gksu_context_set_command ()">gksu_context_set_command</a>            (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *command</code></em>);
const <a href="../glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *       <a class="link" href="libgksu-API-Reference.html#gksu-context-get-command" title="gksu_context_get_command ()">gksu_context_get_command</a>            (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="libgksu-API-Reference.html#gksu-context-set-keep-env" title="gksu_context_set_keep_env ()">gksu_context_set_keep_env</a>           (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> value</code></em>);
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="libgksu-API-Reference.html#gksu-context-get-keep-env" title="gksu_context_get_keep_env ()">gksu_context_get_keep_env</a>           (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>);
<a href="../glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *             <a class="link" href="libgksu-API-Reference.html#gksu-context-get-description" title="gksu_context_get_description ()">gksu_context_get_description</a>        (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="libgksu-API-Reference.html#gksu-context-set-description" title="gksu_context_set_description ()">gksu_context_set_description</a>        (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *description</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="libgksu-API-Reference.html#gksu-context-set-message" title="gksu_context_set_message ()">gksu_context_set_message</a>            (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *message</code></em>);
<a href="../glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *             <a class="link" href="libgksu-API-Reference.html#gksu-context-get-message" title="gksu_context_get_message ()">gksu_context_get_message</a>            (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="libgksu-API-Reference.html#gksu-context-set-login-shell" title="gksu_context_set_login_shell ()">gksu_context_set_login_shell</a>        (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> value</code></em>);
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="libgksu-API-Reference.html#gksu-context-get-login-shell" title="gksu_context_get_login_shell ()">gksu_context_get_login_shell</a>        (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="libgksu-API-Reference.html#gksu-context-set-grab" title="gksu_context_set_grab ()">gksu_context_set_grab</a>               (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> value</code></em>);
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="libgksu-API-Reference.html#gksu-context-get-grab" title="gksu_context_get_grab ()">gksu_context_get_grab</a>               (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="libgksu-API-Reference.html#gksu-context-set-debug" title="gksu_context_set_debug ()">gksu_context_set_debug</a>              (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> value</code></em>);
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="libgksu-API-Reference.html#gksu-context-get-debug" title="gksu_context_get_debug ()">gksu_context_get_debug</a>              (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="libgksu-API-Reference.html#gksu-context-free" title="gksu_context_free ()">gksu_context_free</a>                   (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>);
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="libgksu-API-Reference.html#gksu-run" title="gksu_run ()">gksu_run</a>                            (<em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *command_line</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="libgksu-API-Reference.html#gksu-run-full" title="gksu_run_full ()">gksu_run_full</a>                       (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>,
                                                         <em class="parameter"><code><span class="type">GksuAskPassFunc</span> ask_pass</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> ask_pass_data</code></em>,
                                                         <em class="parameter"><code><span class="type">GksuPassNotNeededFunc</span> pass_not_needed</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> pass_not_needed_data</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="libgksu-API-Reference.html#gksu-su" title="gksu_su ()">gksu_su</a>                             (<em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *command_line</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="libgksu-API-Reference.html#gksu-su-full" title="gksu_su_full ()">gksu_su_full</a>                        (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>,
                                                         <em class="parameter"><code><span class="type">GksuAskPassFunc</span> ask_pass</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> ask_pass_data</code></em>,
                                                         <em class="parameter"><code><span class="type">GksuPassNotNeededFunc</span> pass_not_needed</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> pass_not_needed_data</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="libgksu-API-Reference.html#gksu-sudo" title="gksu_sudo ()">gksu_sudo</a>                           (<em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *command_line</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="libgksu-API-Reference.html#gksu-sudo-full" title="gksu_sudo_full ()">gksu_sudo_full</a>                      (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>,
                                                         <em class="parameter"><code><span class="type">GksuAskPassFunc</span> ask_pass</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> ask_pass_data</code></em>,
                                                         <em class="parameter"><code><span class="type">GksuPassNotNeededFunc</span> pass_not_needed</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> pass_not_needed_data</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<a href="../glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *             <a class="link" href="libgksu-API-Reference.html#gksu-ask-password" title="gksu_ask_password ()">gksu_ask_password</a>                   (<em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<a href="../glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *             <a class="link" href="libgksu-API-Reference.html#gksu-ask-password-full" title="gksu_ask_password_full ()">gksu_ask_password_full</a>              (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *prompt</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="libgksu-API-Reference.description"></a><h2>Description</h2>
<p>
</p>
</div>
<div class="refsect1">
<a name="libgksu-API-Reference.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="GksuError"></a><h3>enum GksuError</h3>
<pre class="programlisting">typedef enum
{
  GKSU_ERROR_XAUTH,
  GKSU_ERROR_HELPER,
  GKSU_ERROR_NOCOMMAND,
  GKSU_ERROR_NOPASSWORD,
  GKSU_ERROR_FORK,
  GKSU_ERROR_EXEC,
  GKSU_ERROR_PIPE,
  GKSU_ERROR_PIPEREAD,
  GKSU_ERROR_WRONGPASS,
  GKSU_ERROR_CHILDFAILED,
  GKSU_ERROR_NOT_ALLOWED,
  GKSU_ERROR_CANCELED,
  GKSU_ERROR_WRONGAUTOPASS
} GksuError;
</pre>
<p>
</p>
</div>
<hr>
<div class="refsect2">
<a name="gksu-context-new"></a><h3>gksu_context_new ()</h3>
<pre class="programlisting"><span class="returnvalue">GksuContext</span> *          gksu_context_new                 (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
创建一个新的 <span class="type">GksuContext</span> 对象，以便作为参数传递给 gksu_su_full 或 
gksu_sudo_full。此函数创建的 <span class="type">GksuContext</span> 对象必须使用 gksu_context_free 释
放。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>一个新建的 <span class="type">GksuContext</span> 对象</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gksu-context-set-user"></a><h3>gksu_context_set_user ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gksu_context_set_user               (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *username</code></em>);</pre>
<p>
设置要以哪个用户的身份运行命令。默认值是root，但可以是任何用户。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>要修改的 <span class="type">GksuContext</span> 对象</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>username</code></em> :</span></p></td>
<td>要使用的用户名</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gksu-context-get-user"></a><h3>gksu_context_get_user ()</h3>
<pre class="programlisting">const <a href="../glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *       gksu_context_get_user               (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>);</pre>
<p>
得到由 gksu_context_set_user 设置的用户名，命令将以此用户的身份运行。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>从中获取信息的 <span class="type">GksuContext</span> 对象</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>包含用户名的字符串或者NULL。</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gksu-context-set-command"></a><h3>gksu_context_set_command ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gksu_context_set_command            (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *command</code></em>);</pre>
<p>
设置要以目标用户身份执行的命令。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>要修改的 <span class="type">GksuContext</span> 对象</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>command</code></em> :</span></p></td>
<td>要执行的命令。</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gksu-context-get-command"></a><h3>gksu_context_get_command ()</h3>
<pre class="programlisting">const <a href="../glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *       gksu_context_get_command            (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>);</pre>
<p>
获取将运行的命令， 设置则为 gksu_context_set_command
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>从中获取信息的 <span class="type">GksuContext</span> 对象</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>包含命令的字符串，如果没有设置则返回NULL</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gksu-context-set-keep-env"></a><h3>gksu_context_set_keep_env ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gksu_context_set_keep_env           (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> value</code></em>);</pre>
<p>
环境变量继续保持吗？默认为TRUE。 注意如果设置为FALSE那么X认证可能会失败。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>要修改的 <span class="type">GksuContext</span> 对象</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td>
<td>TRUE 或者 FALSE</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gksu-context-get-keep-env"></a><h3>gksu_context_get_keep_env ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gksu_context_get_keep_env           (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>);</pre>
<p>
确认是否将要运行的程序会重设环境.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>从中获取信息的 <span class="type">GksuContext</span> 对象</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>如果环境信息继续保存则返回TRUE，否则返回FALSE</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gksu-context-get-description"></a><h3>gksu_context_get_description ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *             gksu_context_get_description        (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>);</pre>
<p>
如果要求输入密码的默认函数被调用，那么得到这个窗口的描述。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>你想要获取的描述信息来自<span class="type">GksuContext</span>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>包含描述信息的字符串，如果没有设置则返回NULL</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gksu-context-set-description"></a><h3>gksu_context_set_description ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gksu_context_set_description        (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *description</code></em>);</pre>
<p>
给将要输入密码的窗口设置一个好点的名字。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>要修改的 <span class="type">GksuContext</span> 对象</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>description</code></em> :</span></p></td>
<td>包含描述信息的字符串</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gksu-context-set-message"></a><h3>gksu_context_set_message ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gksu_context_set_message            (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *message</code></em>);</pre>
<p>
设置在询问密码窗口中显示的信息。该信息仅供默认窗口使用。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>要修改的 <span class="type">GksuContext</span> 对象</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>message</code></em> :</span></p></td>
<td>设置字符串消息</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gksu-context-get-message"></a><h3>gksu_context_get_message ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *             gksu_context_get_message            (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>);</pre>
<p>
如果默认的请求密码的函数被调用，得到这个窗口的消息。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>你想从获取的消息来自 <span class="type">GksuContext</span>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>包含消息的字符串，如果没有设置就返回NULL</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gksu-context-set-login-shell"></a><h3>gksu_context_set_login_shell ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gksu_context_set_login_shell        (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> value</code></em>);</pre>
<p>
运行的命令的shell将成为登录的shell吗？
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>要修改的 <span class="type">GksuContext</span> 对象</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td>
<td>TRUE 或者 FALSE</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gksu-context-get-login-shell"></a><h3>gksu_context_get_login_shell ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gksu_context_get_login_shell        (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>);</pre>
<p>
找出由 su 进程启动的 shell 是不是 login shell。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>从中获取信息的 <span class="type">GksuContext</span> 对象</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>如果要启动一个 login shell，返回TRUE；否则返回FALSE。</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gksu-context-set-grab"></a><h3>gksu_context_set_grab ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gksu_context_set_grab               (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> value</code></em>);</pre>
<p>
</p>
</div>
<hr>
<div class="refsect2">
<a name="gksu-context-get-grab"></a><h3>gksu_context_get_grab ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gksu_context_get_grab               (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>);</pre>
<p>
如果 gksu 被设置为在向用户询问密码时独占键盘和鼠标的使用权，则返回 TRUE。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>要从其中获取 grab 信息的 <span class="type">GksuContext</span> 对象。</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>如果是则返回TRUE,否则返回FALSE</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gksu-context-set-debug"></a><h3>gksu_context_set_debug ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gksu_context_set_debug              (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> value</code></em>);</pre>
<p>
设置debug，调试信息将被打印
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>要修改的 <span class="type">GksuContext</span> 对象</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td>
<td>TRUE 或者 FALSE</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gksu-context-get-debug"></a><h3>gksu_context_get_debug ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gksu_context_get_debug              (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>);</pre>
<p>
查明库是否配置成打印调试信息
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>从中获取信息的 <span class="type">GksuContext</span> 对象</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>如果是DEBUG 返回TRUE,否则返回FALSE</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gksu-context-free"></a><h3>gksu_context_free ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gksu_context_free                   (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>);</pre>
<p>
释放给定的 <span class="type">GksuContext</span>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>释放 <span class="type">GksuContext</span>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gksu-run"></a><h3>gksu_run ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gksu_run                            (<em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *command_line</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
这是对gksu_sudo或者gksu_su的包装函数。 它会根据GConf键中设置的默认行为来调用
其中之一。 如果使用本库，推荐使用这个函数。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>command_line</code></em> :</span></p></td>
<td>此命令行将以其他用户身份执行</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>如果有错误发生，<a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>将根据错误条件而被设置相应的值。</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>成功返回FALSE，有错误发生返回TRUE</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gksu-run-full"></a><h3>gksu_run_full ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gksu_run_full                       (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>,
                                                         <em class="parameter"><code><span class="type">GksuAskPassFunc</span> ask_pass</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> ask_pass_data</code></em>,
                                                         <em class="parameter"><code><span class="type">GksuPassNotNeededFunc</span> pass_not_needed</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> pass_not_needed_data</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
This is a compatibility shim over gksu_run_fuller, which, for
compatibility reasons, lacks the 'exit_status' argument.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>一个 <span class="type">GksuContext</span> 对象</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>ask_pass</code></em> :</span></p></td>
<td>一个 <span class="type">GksuAskPassFunc</span> 型函数指针，通过调用它所指的函数，向用户询问
密码。当该参数为 NULL 时，则使用标准的密码询问对话框。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>ask_pass_data</code></em> :</span></p></td>
<td>一个 <a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>，指向要传给 <span class="type">GksuAskPasswordFunc</span> 的数据。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>pass_not_needed</code></em> :</span></p></td>
<td><span class="type">GksuPassNotNeededFunc</span></td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>pass_not_needed_data</code></em> :</span></p></td>
<td>一个包含用户数据的指针 <a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> ， 它将被传递给
<span class="type">GksuPasswordNotNeededFunc</span> 函数。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>用错误码填充的<a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>对象或者NULL</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>成功返回 TRUE, 否则返回 FALSE</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gksu-su"></a><h3>gksu_su ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gksu_su                             (<em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *command_line</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
gksu_su_run_full的封装函数。它将不还参数调用回调函数，
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>command_line</code></em> :</span></p></td>
<td>此命令行将以其他用户身份执行</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>如果有错误发生，<a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>将根据错误条件而被设置相应的值。</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>如果成功则返回TRUE,如果有错误发生则返回FALSE</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gksu-su-full"></a><h3>gksu_su_full ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gksu_su_full                        (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>,
                                                         <em class="parameter"><code><span class="type">GksuAskPassFunc</span> ask_pass</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> ask_pass_data</code></em>,
                                                         <em class="parameter"><code><span class="type">GksuPassNotNeededFunc</span> pass_not_needed</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> pass_not_needed_data</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
This is a compatibility shim over gksu_su_fuller, which, for
compatibility reasons, lacks the 'exit_status' argument. You should
check the documentation for gksu_su_fuller for information about
the arguments.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>一个 <span class="type">GksuContext</span> 对象</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>ask_pass</code></em> :</span></p></td>
<td>一个 <span class="type">GksuAskPassFunc</span> 型函数指针，通过调用它所指的函数，向用户询问
密码。当该参数为 NULL 时，则使用标准的密码询问对话框。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>ask_pass_data</code></em> :</span></p></td>
<td>一个 <a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>，指向要传给 <span class="type">GksuAskPasswordFunc</span> 的数据。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>pass_not_needed</code></em> :</span></p></td>
<td><span class="type">GksuPassNotNeededFunc</span></td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>pass_not_needed_data</code></em> :</span></p></td>
<td>一个包含用户数据的指针 <a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> ， 它将被传递给
<span class="type">GksuPasswordNotNeededFunc</span> 函数。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>用错误码填充的<a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>对象或者NULL</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>成功返回 TRUE, 否则返回 FALSE</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gksu-sudo"></a><h3>gksu_sudo ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gksu_sudo                           (<em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *command_line</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
此函数是对 gksu_sudo_run_full 的一个封装。它在调用 gksu_sudo_run_full 时，使
用 NULL 作为 ask_pass 和 pass_not_needed 参数，从而使其使用标准对话框。此函数
运行过程中会创建一个 <span class="type">GksuContext</span> 以存放用户名和命令名。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>command_line</code></em> :</span></p></td>
<td>此命令行将以其他用户身份执行</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>如果有错误发生，<a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>将根据错误条件而被设置相应的值。</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>如果成功则返回TRUE,如果有错误发生则返回FALSE</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gksu-sudo-full"></a><h3>gksu_sudo_full ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gksu_sudo_full                      (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>,
                                                         <em class="parameter"><code><span class="type">GksuAskPassFunc</span> ask_pass</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> ask_pass_data</code></em>,
                                                         <em class="parameter"><code><span class="type">GksuPassNotNeededFunc</span> pass_not_needed</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> pass_not_needed_data</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
This is a compatibility shim over gksu_sudo_fuller, which, for
compatibility reasons, lacks the 'exit_status' argument. You should
check the documentation for gksu_sudo_fuller for information about
the arguments.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>一个 <span class="type">GksuContext</span> 对象</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>ask_pass</code></em> :</span></p></td>
<td>一个 <span class="type">GksuAskPassFunc</span> 型函数指针，通过调用它所指的函数，向用户询问
密码。当该参数为 NULL 时，则使用标准的密码询问对话框。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>ask_pass_data</code></em> :</span></p></td>
<td>一个 <a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>，指向要传给 <span class="type">GksuAskPasswordFunc</span> 的数据。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>pass_not_needed</code></em> :</span></p></td>
<td><span class="type">GksuPassNotNeededFunc</span></td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>pass_not_needed_data</code></em> :</span></p></td>
<td>一个包含用户数据的指针 <a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> ， 它将被传递给
<span class="type">GksuPasswordNotNeededFunc</span> 函数。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>用错误码填充的<a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>对象或者NULL</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>成功返回 TRUE, 否则返回 FALSE</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gksu-ask-password"></a><h3>gksu_ask_password ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *             gksu_ask_password                   (<em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
这个函数使用下面的结构来请求得到一个密码， 但是不同于调用su或者使用sudo运行命
令，它只会返回密码。这个函数是对gksu_ask_password_full的包装。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>如果有错误发生，<a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>将根据错误条件而被设置相应的值。</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>分配一个用来保存密码的字符串。</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gksu-ask-password-full"></a><h3>gksu_ask_password_full ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *             gksu_ask_password_full              (<em class="parameter"><code><span class="type">GksuContext</span> *context</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *prompt</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
这个函数使用下面的结构来请求得到一个密码， 但是不同于调用su或者使用sudo运行命
令，它只会返回密码。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
<td>一个 <span class="type">GksuContext</span> 对象</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>prompt</code></em> :</span></p></td>
<td>一则不同于“密码：”的提示信息</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>用错误码填充的<a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>对象或者NULL</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>分配一个用来保存密码的字符串。</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.17</div>
</body>
</html>